<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>模板字符串</title>
</head>

<body>
    <script>
        //1  新的声明字符串方式
        let str = `字符串`;
        console.log(str, typeof str);
        //2  内容中可以直接出现换行符
        // let str1 ='<ul>     //之前的字符串这样定义会报错
        //     <li></li>
        //     </ul>';
        let str1 = `<ul>       
            <li>sun/li>
            <li>xu</li>
            </ul>`;
        //字符串拼接
        let name = `sunjinyao`;
        let out = `热烈欢迎${name}`;
        console.log(out);

        //3  简化对象写法
        const duixiang = {
            name,
            age: 18,
            skill() {
                console.log('唱歌');
            },
        }
        console.log(duixiang);
    </script>
</body>

</html>